Skip to main content

All Questions

2votes
3answers
199views

Is it still "feature envy" if the state to make decision or the action to take after asking the state involves other classes to participate?

According to https://softwareengineering.stackexchange.com/a/212130/432039, if a class asks another class for the state, and then call methods of that class, it is called "feature envy", eg: ...
wcminipgasker2023's user avatar
0votes
2answers
2kviews

Is "error first" better than "if-else", why? [duplicate]

I have an eternal discussion in my work about why "error first" is "worng". In order to ensure what I try to tell with error first is the following code pattern: if condition: ...
Tlaloc-ES's user avatar
4votes
2answers
618views

Is using spacing effectively equivalent to the long method code smell?

There's a common code smell involving long methods with the most common answer being that methods should be really small, less than 50 lines per say (or 20). I understand why this is because it ...
Jake's user avatar
  • 151
10votes
4answers
1kviews

Reworking a function returning an integer code that represents many different statuses

I've inherited some awful code that I've included a short sample of below. Is there a name for this particular anti-pattern? What are some recommendations for refactoring this? // 0=Need to log in / ...
A_B's user avatar
  • 409
5votes
2answers
357views

Is there a name for the anti-pattern of having low-level components controlling higher-level ones?

For example, suppose I had a pageControl UI class and a searcher business logic class with the following : pageControl.js function searchButtonClicked() { // call business logic class method when ...
Katana314's user avatar
12votes
7answers
6kviews

what should be logger's position in the parameter list [closed]

In my code I inject a logger to many of my classes through their constructor's parameter list I noticed that I put it randomly: sometimes it's the first on the list, sometimes last, and sometimes in ...
Ezra's user avatar
  • 365
5votes
5answers
2kviews

Should the method describe its side effects? [duplicate]

I was reading Clean Code by Bob Martin and there's one particular code smell, related to naming, that looks interesting to me: N7: Names Should Describe Side-Effects Names should describe ...
dragan.stepanovic's user avatar
0votes
1answer
164views

Less code or less operation [closed]

Sometimes I hesitate between "More code to avoid unnecessary operations" and "less code but with redundant operations". Let me just take an example (Win32 API): I try to paint some controls manually ...
user565739's user avatar
2votes
4answers
1kviews

Is extensive documentation a code smell? [closed]

Every library, open-source project, and SDK/API I've ever come across has come packaged with a (usually large) documentation file, and this seems contradictory to the wide-spread belief that good code ...
Griffin's user avatar

close